/* *****************************************************************************
 * JFab (http://code.google.com/p/jfab)
 * Copyright (c) 2011 JFab.org
 * Admin jfab@jeffreythompson.net
 *
 * See the file "LICENSE.txt" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 * *****************************************************************************/

package org.jfab.core;

import java.io.File;
import java.io.Writer;

import org.jfab.core.model.CGClass;
import org.jfab.core.model.CGEnum;
import org.jfab.core.model.CGInterface;
import org.jfab.core.model.CGSpec;

/**
 * Defines methods required by a code generator.
 */
public interface JFabber
{
    /**
     * Write the given parameter to a file.
     * 
     * @param writer Writer.
     * @param cgClass Code generator class.
     */
    void generate(final Writer writer, final CGClass cgClass);

    /**
     * Write the given parameter to a file.
     * 
     * @param writer Writer.
     * @param cgEnum Code generator enum.
     */
    void generate(final Writer writer, final CGEnum cgEnum);

    /**
     * Write the given parameter to a file.
     * 
     * @param writer Writer.
     * @param cgInterface Code generator interface.
     */
    void generate(final Writer writer, final CGInterface cgInterface);

    /**
     * Write files as indicated by the given parameters.
     * 
     * @param cgSpec Root object containing code generator instructions.
     * @param baseDirectory Base directory for Java code output.
     * @return the inflated code generator specification.
     */
    CGSpec generateCodeFiles(CGSpec cgSpec, File baseDirectory);
}
